package rm.ep.server;

import java.util.List;

import rm.ep.shared.FileEntity;
import rm.ep.shared.ProgressEntity;

public class ProgressDAO extends BaseDAO {

	public ProgressEntity insert(String staff, String addressees, String progress, 
			com.google.appengine.api.datastore.Key parent, Long fileEntityId) {
		ProgressEntity p = new ProgressEntity(staff, addressees, progress, parent, fileEntityId);
		if (fileEntityId != null) {
			FileEntity f = ofy().get(FileEntity.class, fileEntityId);
			f.setActive(Boolean.TRUE);
		}
		ofy().put(p);
		return p;
	}
	
	public List<ProgressEntity> ofParent(com.google.appengine.api.datastore.Key parent) {
		return getChildren(parent, ProgressEntity.class);
	}

}
